import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ArcoVue from '@arco-design/web-vue'
import ArcoVueIcon from '@arco-design/web-vue/es/icon'
import '@arco-design/web-vue/dist/arco.css'
import 'vue-echarts'
import 'echarts/lib/chart/line'
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/pie'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/legend'
import 'echarts/lib/component/grid'

import App from './App.vue'
import router from './router'
import './styles/index.scss'
import { useUserStore } from './stores/user'

// FontAwesome
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

const app = createApp(App)

const pinia = createPinia()

app.use(pinia)
app.use(router)
app.use(ArcoVue)
app.use(ArcoVueIcon)

// 注册 FontAwesome 组件
app.component('font-awesome-icon', FontAwesomeIcon)

// 初始化用户信息（恢复登录状态）
const userStore = useUserStore()
userStore.initUser()

app.mount('#app')
